<template>
  <div class="video-list">
    <div class="centent" v-for="(item,index) in listArray" @click="videoPlay(item.id)">
      <div class="top">
        <img :src="item.image" alt="">
        <span>{{item.timer}}</span>
      </div>
      <div class="middle">
        <div class="left"><img :src="item.headPhone" alt=""><span>{{item.name}}</span></div>
        <div class="right" :class="item.attention==1?'grey':'pink'">{{item.attention==1?'已关注':'关注'}}</div>
      </div>
      <div class="middleText">{{item.details}}</div>
      <div class="bottom">
        <div class="heart" :class="item.heart==1?'red':'white'"></div>
        <div>{{item.heartNum}}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "video-list",
    props: {
      listArray: {
        type: Array,
        default: []
      }
    },
    data() {
      return {}
    },
    methods:{
      videoPlay(id){
        this.$router.push({'path': "/VideoPlay",query:{id:id}})
      }
    }
  }
</script>

<style scoped lang="scss">
  .video-list {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    .centent {
      width: 49%;
      margin-bottom: 5px;
      border-radius: 10px 10px 0 0;
      box-shadow: 1px 2px 3px 1px #ccc;
      overflow: hidden;

      .top {
        width: 100%;
        position: relative;
        img {
          width: 100%;
          min-height: 250px;
          height: 250px;
        }
        span {
          position: absolute;
          bottom: 5px;
          right: 5px;
          color: white;
          font-size: 13px;
        }
      }
      .middle {
        width: 100%;
        height: 20px;
        padding: 0 2px;
        box-sizing: border-box;
        margin: 5px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .left {
          img {
            width: 15px;
            height: 15px;
            border-radius: 50%;
            vertical-align: middle;
            margin-right: 5px;
          }
          span {
            font-size: 11px;
          }

        }
        .right {
          min-width: 50px;
          text-align: center;
          padding: 1px 0;
          font-size: 12px;
        }
        .pink {
          background: palevioletred;
          color: white;
        }
        .grey {
          background: gainsboro;
          color: #000;
        }
      }
      .middleText {
        width: 100%;
        font-size: 12px;
        padding: 0 2px;
        box-sizing: border-box;
        margin-bottom: 2px;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      .bottom {
        width: 100%;
        height: 20px;
        display: flex;
        padding: 0 2px;
        box-sizing: border-box;
        justify-content: flex-end;

        .heart {
          position: relative;
          width: 20px;
          height: 100%;
        }

        .red:before, .red:after {
          background: red;
        }

        .white:before, .white:after {
          background: #ccc;
        }

        .heart:before, .heart:after {
          position: absolute;
          content: "";
          left: 9px;
          top: 2px;
          width: 9px;
          height: 14px;
          border-radius: 9px 9px 0 0;
          transform: rotate(-45deg);
          transform-origin: 0 100%;
        }
        .heart:after {
          left: 0;
          transform: rotate(45deg);
          transform-origin: 100% 100%;
        }
      }
    }

  }
</style>
